package com.example.hsh.homefragment.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.example.hsh.homefragment.R;
import com.example.hsh.homefragment.model.ListContentModel;

/**
 * Created by HSH on 2016/12/19.
 */

public class ListContentAdapter extends BaseAdapter<ListContentModel> {

    public static final int COLUMN_ONE = 1;
    public static final int COLUMN_TWO = 2;
    public static final int COLUMN_THREE = 3;


    public ListContentAdapter(Context context) {
        super(context);
    }

    @Override
    public int getItemLayoutRes() {
        return 0;
    }

    @Override
    public void onBindView(BaseHolder holder, ListContentModel bean, int position) {

    }

    @Override
    public BaseHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new BaseHolder(inflater.inflate(viewType, parent, false));
    }

    @Override
    public int getItemViewType(int position) {
        ListContentModel model = datas.get(position);
        switch (model.column) {
            case COLUMN_ONE:
                return R.layout.layout_of_content_list_item_one;
            case COLUMN_TWO:
                return R.layout.layout_of_content_list_item_two;
            case COLUMN_THREE:
                return R.layout.layout_of_content_list_item_three;
        }
        return R.layout.layout_of_content_list_item_one;
    }
}
